package com.rjpacket.supernews.app;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;


public class MySettingsActivity extends BaseActivity implements View.OnClickListener {

    private ImageView notification;
    private TextView send;
    private TextView tutorial;
    private TextView about;
    private int flag = 0;
    private TextView huancun;
    private TextView shoudong;
    private TextView jiancha;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_settings);

        TextView actionBar = (TextView) findViewById(R.id.actionbar_title);
        actionBar.setText("我的设置");

        notification = (ImageView) findViewById(R.id.notification_text);
        send = (TextView) findViewById(R.id.send_advice_text);
        tutorial = (TextView) findViewById(R.id.tutorial_new_text);
        about = (TextView) findViewById(R.id.about_text);
        huancun = (TextView) findViewById(R.id.huancun);
        shoudong = (TextView) findViewById(R.id.shoudong);
        jiancha = (TextView) findViewById(R.id.jiancha);


        notification.setOnClickListener(this);
        huancun.setOnClickListener(this);
        shoudong.setOnClickListener(this);
        jiancha.setOnClickListener(this);
        send.setOnClickListener(this);
        tutorial.setOnClickListener(this);
        about.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            //通过标记判断推送的开关
            case R.id.notification_text:
                if (flag == 0) {
                    notification.setImageResource(R.drawable.setting_cb_off);
                    flag = 1;
                } else {
                    notification.setImageResource(R.drawable.setting_cb_on);
                    flag = 0;
                }
                break;
            //跳转到意见反馈页面
            case R.id.send_advice_text:
                Intent intent = new Intent(this, SendAdviceActivity.class);
                startActivity(intent);
                break;
            //跳转到新手导航页面
            case R.id.tutorial_new_text:
                Intent intent1 = new Intent(this, TutorialActivity.class);
                startActivity(intent1);
                break;
            //跳转到软件信息界面
            case R.id.about_text:
                Intent intent2 = new Intent(this, About.class);
                startActivity(intent2);
                break;
            case R.id.huancun:
                Toast.makeText(this, "缓存已经清理", Toast.LENGTH_SHORT).show();
                break;
            case R.id.shoudong:
                Toast.makeText(this, "离线下载已经开启", Toast.LENGTH_SHORT).show();
                break;
            case R.id.jiancha:
                Toast.makeText(this, "已经是最新版本", Toast.LENGTH_SHORT).show();
                break;
        }
    }
}

